<%-- 
    Document   : manage
    Created on : Sep 22, 2011, 4:06:12 PM
    Author     : Yudi Retanto
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<jsp:include page="/header.jsp"></jsp:include>
<h1>
    Manage Shuttle
</h1>
<script type="text/javascript">
    function changeCity(){
        city = $('#sCity').val();
        if(city != 0){
            $('#sPool').load('./shuttles?action=manage&get=pool&city='+city);
            $('#defCity').remove();
        }        
    }
    function changePool(){
        pool = $('#sPool').val();
        if(pool != 0){
            $('#manageSched').load('./shuttles?action=manage&get=schedule&pool='+pool);
            $('.defPool').remove();
        }        
    }
</script>
<table id="manageForm">
    <tr>
        <td style="width: 20%;">
            <label for="name">Kota Keberangkatan :</label>
        </td>
        <td>
            <select id="sCity" name="city" onchange="changeCity();">
                <option id="defCity" value="0" selected="selected">Pilih Kota Keberangkatan</option>
                <c:forEach items="${cities}" var="city">
                    <option value="${city.getId()}">${city.getName()}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <label for="name">Pool Keberangkatan :</label>
        </td>
        <td>
            <select id="sPool" name="pool" onchange="changePool();">
            </select>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <table id="manageSched">
                
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <a href="./shuttles?action=manage&mode=add">Tambah Jadwal</a>
        </td>
    </tr>
</table>
<jsp:include page="/footer.jsp"></jsp:include>